package com.ItemsRent.action;

import net.sf.json.JSONObject;

import com.ItemsRent.model.User;

public class TestAjaxAction {
	
	private String name;
	private String password;
	private String result;
	
	public String getResult() {
		return result;
	}
	public void setResult(String result) {
		this.result = result;
	}
	
	
	public String getPassword() {
		return password;
	}
	public void setPassword(String password) {
		this.password = password;
	}
	
	public String test(){
		System.out.println(name+", "+password);
		JSONObject jsonObject = new JSONObject();
		jsonObject.put("username", name);
		jsonObject.put("password", password);
		User user = (User)JSONObject.toBean(jsonObject, User.class);
		System.out.println("user: "+user.getPassword()+", "+user.getUsername()+", "+user.getId());
		JSONObject json = JSONObject.fromObject(user);
		result = json.toString();
		System.out.println("result: "+result);
		return "success";
	}
	
	public static void main(String[] agrs){
		TestAjaxAction test1 = new TestAjaxAction();
		test1.name = "yrfv";
		test1.password = "123";
		test1.test();
	}
	public String getName() {
		return name;
	}
	public void setName(String name) {
		this.name = name;
	}
}
